﻿//在舞台上选中一个元素, 运行该命令得到该元素的链接类名.
//tamt	2009.08.19
var theSelectionArray = fl.getDocumentDOM().selection; 

for(var i=0;i<theSelectionArray.length;i++){ 
	var element = theSelectionArray[i]
	if(element.elementType == 'instance'){
		var instance = element;
		var lbItem = element.libraryItem;
		if(lbItem && lbItem.linkageExportForAS){
			fl.trace(lbItem.linkageClassName);
			fl.clipCopyString(lbItem.linkageClassName);
			if(lbItem.name.lastIndexOf('/')>0){
				var pathNames = lbItem.name.split('/');
				var path = '';
				for(var j=0; j<pathNames.length; j++){
					path += (j==0?'':'/') + pathNames[j];
					fl.getDocumentDOM().library.expandFolder(true, false, path);
				}
				
			}
			fl.getDocumentDOM().library.selectItem(lbItem.name);
		}else{
			alert('该元素没有链接属性.');
		}
	}
}

if(i==0)alert('请先选中舞台上一个元素');